<?php 
session_start();
include "conexao.php";
$id_categoria = $_GET["id_categoria"];
$acao 	= $_GET["acao"];
if($_GET["s"]=="s"){

echo "<h1><font color=green>An&uacute;ncio inserido com sucesso</font></h1>"; exit();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}</script>


<style type="text/css">
.carregando{
				color:#666;
				display:none;
			}
</style>

<script type="text/javascript" src="admin/jscripts/tiny_mce/tiny_mce.js" charset="utf-8"></script>

<script language="javascript" type="text/javascript">
      tinyMCE.init({
         mode : "textareas",
         theme : "advanced",
		
		 theme_advanced_buttons2 : "image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		 
		 theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "center",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,

      });
   </script>
   <script type="text/javascript">
        var GB_ROOT_DIR = "./greybox/";
    </script>
     <script type="text/javascript" src="greybox/AJS.js"></script>
    <script type="text/javascript" src="greybox/gb_scripts_home.js"></script>
      <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />
   <link rel="stylesheet" type="text/css" href="estilo.css" />
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   <script src="jsapi.js"></script>
	<script type="text/javascript"> google.load('jquery', '1.3'); </script>

	<script type="text/javascript">
		$(function(){
			$('#txtidcategoria').change(function(){
				if( $(this).val() ) {
					$('#txt_idsubcategoria').hide();
					$('.carregando').show();
					$.getJSON('cat_subcat.ajax.php?search=',{txtidcategoria: $(this).val(), ajax: 'true'}, function(j){
						var options = '<option value="">Escolha uma subcategoria</option>';	
						for (var i = 0; i < j.length; i++) {
							options += '<option value="' + j[i].txt_idsubcategoria + '">' + j[i].nome + '</option>';
						}	
						$('#txt_idsubcategoria').html(options).show();
						$('.carregando').hide();
					});
				} else {
					$('#txt_idsubcategoria').html('<option value="">Escolha uma subcategoria</option>');
				}
			});
		});
		</script>
        <script type="text/javascript" src="criticas.js" charset="utf-8"></script>
</head>

<body>
<table width="100%" border="0">
  <tr>
    <td width="5%">&nbsp;</td>
    <td width="18%"><img src="img/logo.gif" width="193" height="124" /></td>
    <td width="77%">&nbsp;</td>
  </tr>
</table>

<table width="100%" border="0">
  <tr>
    <td><form id="form1" enctype="multipart/form-data" name="form1" method="post" action="op_anuncio_categoria.php" onsubmit="return critica()">
      <table width="100%" border="0">
       <script type="text/javascript">
GB_myShow = function(caption, url, /* optional */ height, width, callback_fn) {
    var options = {
        caption: caption,
        height: height || 1300,
        width: width || 800,
        fullscreen: true,
        show_loading: true,
        callback_fn: callback_fn
    }
    var win = new GB_Window(options);
    return win.show(url);
}
</script>
        <tr>
          <td width="45%"><div align="right">Selecione a Categoria</div></td>
          <td width="55%"><label>
            <div align="left">
              <select name="txtidcategoria" id="txtidcategoria">
      <option value="">Escolha uma categoria</option>
      <?php
				$sql = mysql_query("SELECT id_categoria, categoria FROM categoria_servicos");
				while ($row = mysql_fetch_array($sql)) {
					echo '<option value="'.$row['id_categoria'].'">'.$row['categoria'].'</option>';
					
					//print "<option value = \"$row[id_categoria]\">$row[categoria]</option>";
				}
			?>
    </select>
            </div>
            </label></td>
        </tr>
        <?php //if($id_categoria!=""){?>
        <tr>
          <td><div align="right">Selecione a subCategoria</div></td>
          <td><label>
            <label>
            <div align="left">
            <span class="carregando">Aguarde, carregando subcategorias...</span>
              <select name="txt_idsubcategoria" id="txt_idsubcategoria">
			<option value="">-- Escolha uma subcategoria --</option>
		</select>
            </div>
            </label>
            <div align="left"></div>
          </label></td>
        </tr>
        <tr>
          <td><div align="right">Incluir Foto </div></td>
          <td><label>
            <div align="left">
              <input type="file" name="nome_arquivo" id="nome_arquivo" />
              <br />
              Tamanho m&aacute;ximo 500 kbytes<br />
              </div>
          </label></td>
        </tr>
        <tr>
          <td><div align="right">Empresa ou Nome Fantasia ou Nome do Anunciante que Aparecerá no Anúncio</div></td>
          <td><div align="left">
            <input name="nome" type="text" id="nome" value="" size="40"/>
          </div></td>
        </tr>
        <tr>
          <td><div align="right">Valor:</div></td>
          <td><div align="left">
            <input type="text" name="valor" id="valor" class="keyboardInput" onkeyup="javascript:numero(this);" value=""/>
            <strong>Digite Apenas o valor sem v&iacute;rgula (,) nem ponto (.)</strong></div></td>
        </tr>
        <tr>
          <td><div align="right">Endereço:</div></td>
          <td><div align="left">
            <label></label>
            
            <input name="endereco" type="text" id="endereco" size="40" />
          </div></td>
        </tr>
        <tr>
          <td><div align="right">Tipo:</div></td>
          <td><div align="left">
            <label>
            <select name="tipo" id="tipo">
           <option value="">Selecione o tipo</option>
              <option value="Rua">Rua</option>
              <option value="Avenida">Avenida</option>
              <option value="Rodovia" >Rodovia</option>
               <option value="Travessa"  >Travessa</option>
                <option value="Alameda">Alameda</option>
            </select>
            </label>
          </div></td>
        </tr>
          <tr>
          <td><div align="right">Bairro:</div></td>
          <td><div align="left">
            <label></label>
            <input type="text" name="bairro" id="bairro" />
          </div></td>
        </tr>
        <tr>
          <td><div align="right">Número::</div></td>
          <td><div align="left">
            <label></label>
            <input type="text" name="numero" id="numero" />
          </div></td>
        </tr>
        <tr>
          <td><div align="right">Estado:</div></td>
          <td><label>
            <div align="left">
              <select name="estado" id="estado">
                <option value="">Selecione o Estado</option>
                <option value="ce" <?php if($estado =="ce") echo "selected"?>>Cear&aacute;</option>
                <option value="ac" <?php if($estado =="ac") echo "selected"?>>Acre</option>
                <option  value="al" <?php if($estado =="al") echo "selected"?>>Alagoas</option>
                <option  value="ap" <?php if($estado =="ap") echo "selected"?>>Amap&aacute;</option>
                <option  value="am" <?php if($estado =="am") echo "selected"?>>Amazonas</option>
                <option  value="ba" <?php if($estado =="ba") echo "selected"?>>Bahia</option>
                <option  value="df" <?php if($estado =="df") echo "selected"?>>Distrito Federal</option>
                <option  value="es"<?php if($estado =="es") echo "selected"?>>Esp&iacute;rito Santo</option>
                <option  value="go" <?php if($estado =="go") echo "selected"?>>Goi&aacute;s</option>
                <option  value="ma" <?php if($estado =="ma") echo "selected"?>>Maranh&atilde;o</option>
                <option  value="mt" <?php if($estado =="mt") echo "selected"?>>Mato Grosso</option>
                <option  value="mts" <?php if($estado =="mts") echo "selected"?>>Mato Grosso do Sul</option>
                <option  value="mg" <?php if($estado =="mg") echo "selected"?>>Minas Gerais</option>
                <option  value="pa" <?php if($estado =="pa") echo "selected"?>>Par&aacute;</option>
                <option  value="pr" <?php if($estado =="pr") echo "selected"?>>Paran&aacute;</option>
                <option  value="pb" <?php if($estado =="pb") echo "selected"?>>Para&iacute;ba</option>
                <option  value="pe" <?php if($estado =="pe") echo "selected"?>>Pernambuco</option>
                <option  value="pi" <?php if($estado =="pi") echo "selected"?>>Piau&iacute;</option> 
                <option  value="rj" <?php if($estado =="rj") echo "selected"?>>Rio de Janeiro</option>
                <option  value="rn" <?php if($estado =="rn") echo "selected"?>>Rio Grande do Norte</option>
                <option  value="rs" <?php if($estado =="rs") echo "selected"?>>Rio Grande do Sul</option>
                <option  value="ro" <?php if($estado =="ro") echo "selected"?>>Rond&ocirc;nia</option>
                <option  value="rr" <?php if($estado =="rr") echo "selected"?>>Roraima</option>
                <option  value="sc" <?php if($estado =="sc") echo "selected"?>>Santa Catarina</option>
                <option  value="sp" <?php if($estado =="sp") echo "selected"?>>S&atilde;o Paulo</option>
                <option  value="se" <?php if($estado =="se") echo "selected"?>>Sergipe</option>
                <option  value="to" <?php if($estado =="to") echo "selected"?>>Tocantins</option>
              </select>
            </div>
          </label></td>
        </tr>
        <tr>
          <td><div align="right">Cidade</div></td>
          <td><div align="left">
            <input name="cidade" type="text" id="cidade" value="" />
          </div></td>
        </tr>
         <tr>
          <td><div align="right">Fone:</div></td>
          <td><div align="left">
            <input name="fone" type="text" id="fone" value="" />
          </div></td>
        </tr>
        <tr>
          <td><div align="right">ddd:</div></td>
          <td><div align="left">
            <input name="ddd" type="text" id="ddd" value="" size="7" maxlength="3" />
          </div></td>
        </tr>
        <tr>
          <td><div align="right">Site:</div></td>
          <td><div align="left">
            <input name="site" type="text" id="site" value="" size="40" maxlength="200" />
          (opcional)</div></td>
        </tr>
        <tr>
          <td><div align="right">Email:</div></td>
          <td><div align="left">
            <input name="email" type="text" id="email" value="" size="40" maxlength="200" />
          </div></td>
         </tr
        
       
        
        ><tr>
          <td><div align="right">Titulo:</div></td>
          <td><label>
            <div align="left">
              <input name="titulo" type="text" id="titulo" size="55" maxlength="89" value=""/>
              </div>
          </label></td>
        </tr>
        <tr>
          <td>Descri&ccedil;&atilde;o</td>
          <td><label>
            <textarea name="descricao" cols="25" rows="15" id="descricao"></textarea>
          </label></td>
        </tr>
        <tr>
          <td><input name="id" type="hidden" id="id" value="<?php echo $id; ?>" />
          <input name="acao" type="hidden" id="acao" value="<?php if ($acao !="") {echo $acao;}?>" />
          <input name="id_categoria" type="hidden" id="id_categoria" value="<?php echo $id_categoria;?>" />
          <input name="id_anuncio" type="hidden" id="id_anuncio" value="<?php echo $_GET["id_anuncio"];?>" />
          <input name="txt_foto" type="hidden" id="txt_foto" value="<?php echo $foto;?>" /></td>
          <td><label>
         
   <input type="submit" name="button" id="button" value="Salvar" />
          </label></td>
        </tr>
      </table>
        </form>
     </td  ></tr><?php //}?>
>
</table>
</body>
</html>
